home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / FredFish PD 304.adf / Skel / abouthelp.c < prev    next >
C/C++ Source or Header  |  1990-01-10  |  2KB  |  96 lines

  1. /*
  2.  * abouthelp.c : file containing about(), and help(), as well as
  3.  *    all the text structs for autorequesters.
  4.  */
  5.  
  6. #include <intuition/intuition.h>
  7. #include "helpwin.h"
  8.  
  9.  
  10. /*
  11.  *  Handle help request
  12.  */
  13.  
  14. extern struct Window *wG; /* main window */
  15. struct Window *wH;        /* help window */
  16. struct RastPort *rpH;     /* help RastPort */
  17.  
  18. struct Window *OpenWindow();
  19. struct IntuiMessage *GetMsg();
  20. struct TextFont *OpenFont();
  21.  
  22. help()
  23. {
  24.     struct IntuiMessage *message;    /* the message from the IDCMP */
  25.     struct TextFont *font;
  26.     ULONG class;
  27.     int i, j;
  28.     int dun = FALSE;
  29.  
  30.     font = NULL;
  31.     wH = NULL;
  32.  
  33.     wH = OpenWindow(&NewWindowStructureHelp);    /* open the window */
  34.     if ( wH == NULL )
  35.         {
  36.         AutoRequest(wG,&winfailtxt,0L,&oktxt,0L,0L,300L,75L);
  37.         return;
  38.         }
  39.  
  40.     rpH = wH->RPort;    /* get a rastport pointer for the window */
  41.  
  42.     font = OpenFont(&TOPAZ80); /* make sure correct size font */
  43.     if (font) SetFont(rpH,font);
  44.     SetAPen(rpH,1L);
  45.     i = 0;
  46.  
  47.     while (!dun) /* repeat til all of text array has been read */
  48.         {
  49.         for (j=0; i<40; j++, i++)    /* dump the help text array */
  50.             {
  51.             if (!HelpText[i]) { dun=TRUE;  break;}
  52.             if (*HelpText[i] == '\f')  { ++i; break; } /* pause for page */
  53.             Move(rpH,25L,(long) j*8+20);
  54.             if (*HelpText[i] != '\0' )
  55.                 Text(rpH,HelpText[i], (long) strlen(HelpText[i]));
  56.             }
  57.         while(1)    /* Process all messages */
  58.             {
  59.             WaitPort(wH->UserPort); /* wait for a message */
  60.                 while( (message = (struct IntuiMessage *)
  61.                     GetMsg(wH->UserPort) ) != NULL)
  62.                 {
  63.                     class = message->Class;
  64.                     ReplyMsg(message);
  65.                     switch (class)
  66.                         {
  67.                         case GADGETUP:  /* MORE is the only gadget */
  68.                             goto next;
  69.                             break;
  70.                         case MENUPICK:
  71.                             continue;
  72.                         }
  73.                 }
  74.             } 
  75.   next:
  76.         SetAPen(rpH,0L);   /* clear window for next page */
  77.         RectFill(rpH,2L,12L,(long)wH->Width-3L,(long)wH->Height-2L);
  78.         RefreshGList(&HelpDone_Gad,wH,NULL,-1L);
  79.         SetAPen(rpH,1L);
  80.         }
  81.     if (font) CloseFont(font);
  82.     if (wH) CloseWindow(wH);
  83.  
  84. }
  85.  
  86.  
  87. /*
  88.  *  Handle 'about' request
  89.  */
  90.  
  91.  
  92. about()
  93. {
  94.     AutoRequest(wG,&aboutmsg,0L,&oktxt,0L,0L,300L,75L);
  95. }
  96.